<template>
  <el-container class="index-box">
    <el-aside width="asideWidth">
      <div class="logoBox d-flex" style="width:100%"><!-- :style="{width:(!collapse?'240px':'64px')}" -->
      	<img :src="require('@/assets/logo.png')" alt="" class="logoImg">
      </div>
      <menus :isCollapse="isCollapse"/>
    </el-aside>
    <el-container>
      <el-header style="height:103px">
        <headers/>
        <tabs/>
      </el-header>
      <el-main>
        <div id="indexMainBox" class="d-flex">
            <div style="flex:1;width: 100%;">
                <div id="mainBackbone" >
                    <transition name="fade-transform" mode="out-in">
                      <!--  <keep-alive exclude='dictionariesDetail,shopDetails,orderDetail'>-->
                          <router-view v-if="isRouterAlive" :key="$route.fullPath"/>
                      <!-- </keep-alive>-->
                    </transition>
                </div>
            </div>

            <!-- <div id="indexRightActive">
                <div class="storeHelpBox" @click="handleGoStoreHelp">
                  <img src="@/assets/storeHelp.png" alt="">
                  商家帮助
                </div>
                <div class="phoneBox" >
                  <el-popover
                      placement="left"
                      width="50"
                      trigger="hover"
                      :content="serviceCall">
                      <div slot="reference" class="box">
                        <img src="@/assets/phone.png" alt="">
                        服务电话
                      </div>
                    </el-popover>
                </div>
            </div> -->
        </div>
        <div class="copyright"><a href="https://beian.miit.gov.cn" target="_blank">粤ICP备2024299708号-2 </a></div>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Menus from '@/components/Menus/menus';
import Headers from '@/components/Header/header';
import Tabs from '@/components/Tabs/tabs';
import common from '@/api/api';
export default {
  provide () {
    return {
      reload: this.reload
    }
  },
  data () {
    return {
      isRouterAlive: true,
      storeImg:'/',
      serviceCall:'',
    }
  },
  created() {
     let userDetail = JSON.parse(this.$store.state.userDetails);
     //this.storeImg = userDetail.storeCache?userDetail.storeCache.logo:'';
     this.serviceCall = userDetail.phoneNumber;
  },
  components: {
    Menus,
    Headers,
    Tabs
  },
  methods: {
    reload () {
      this.isRouterAlive = false
      this.$nextTick(() => {
      	console.log(333)
        this.isRouterAlive = true
      })
    },
    handleGoStoreHelp(){
      this.$router.push('/storeHelp')
    }
  },
  computed: {
    isCollapse () {
      return this.$store.state.isCollapse
    },
    asideWidth () {
      return this.$store.state.isCollapse ? 'auto' : '200px'
    }
  }
}
</script>

<style lang="scss">
  .phoneBox{
    margin-top:20px;
    .box{
      display: flex;
      justify-content: center;
      flex-wrap: wrap;
      cursor: pointer;
      padding:0 10px;
      text-align: center;
    }
    img{
      margin-bottom:5px;
      width:20px;

    }
  }
  .storeHelpBox{
    margin-top:20px;
    padding:0 10px;
    text-align: center;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    cursor: pointer;
    img{
      margin-bottom:5px;
      width:20px;

    }
  }
  #indexRightActive{
    width:60px;
    background-color: #E5E9E6;
  }
  .copyright{
    text-align: center;
    color:#606266;
    font-size: 12px;
    margin-bottom: 10px;
  }
  #mainBackbone>.index-box{
    height:100%;
  }
  #mainBackbone{
    height: calc(100vh - 155px);
    margin:15px 15px 10px 15px;
    background: #fff;
  }
  .logoBox{
    display: flex;
    justify-content: center;
    padding:0 10px;
    height:80px;
    font-size: 16px;
    font-weight: bold;
    color:#FFF;
    .logoImg{
      margin-top:20px;
      width: 50px;
      height: 50px;

    }
    span{
      font-size: 15px;
      font-weight: 600;
      margin-left: 10px;
    }
  }
.index-box /deep/ .el-menu.el-menu--inline	li{
	//background: #1f2d3d!important;
}
.index-box /deep/ .el-menu.el-menu--inline li:hover{
	background: #fff!important;
}
#app>.index-box {
  font-family:sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #F1F1F1;
  height: 100vh;
  .el-container{
    height: 100%;
    .el-main {
      height: 100%;
      padding:0px!important;
	  background: #f0f2f5;
	  overflow-x: hidden;
    }
  }
  .el-aside {
    background-color: #333;
    height: 100vh;
    min-height: 100%;
    .logo {
      background-color: #304156;
      color: rgba(255,255,255,.8);
      text-align: center;
      height: 90px;
      padding-top: 16px;
      font-size: 16px;
      box-sizing: border-box;
      border-bottom: 1px solid gray;
    }
  }
  .el-header {
    border-bottom: 1px solid #f6f6f6;
    box-sizing: border-box;
    background-color: #fff;
    line-height: 60px;
    padding:0 15px;
  }
}
</style>
